package com.duoduo.springboot.security.vo;

import org.springframework.beans.BeanUtils;

import com.duoduo.springboot.security.model.Permission;

/**
 * 权限VO
 * @author cgs1999@126.com
 * @date 2018年5月6日 下午8:52:02
 * @version 1.0.0
 */
public class PermissionVO extends BaseVO<Integer> {

	private static final long serialVersionUID = 5563855910516073731L;
	private String name;
	private String url;

	public PermissionVO() {

	}

	public PermissionVO(Integer id, String name, String url) {
		setId(id);
		this.name = name;
		this.url = url;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * Entity转VO
	 * @param entity
	 * @return
	 */
	public static PermissionVO fromEntity(Permission entity) {
		PermissionVO vo = new PermissionVO();
		BeanUtils.copyProperties(entity, vo);
		return vo;
	}

	/**
	 * VO转Entity
	 * @param vo
	 * @return
	 */
	public static Permission fromEntity(PermissionVO vo) {
		Permission entity = new Permission();
		BeanUtils.copyProperties(vo, entity);
		return entity;
	}
}
